package

com.tel.service.impl;

import .entity.CoursePlayHistory;
import .dao.CoursePlayHistoryDao;
import com.tel.service.CoursePlayHistoryService;
import org.springframework.stereotypecom.tel.service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (CoursePlayHistory)表服务实现类
 *
 * @author Candy
 * @since 2021-04-21 02:12:23
 */
@Service("coursePlayHistoryService")
public class CoursePlayHistoryServiceImpl implements CoursePlayHistoryService {
    @Resource
    private CoursePlayHistoryDao coursePlayHistoryDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public CoursePlayHistory queryById(Object id) {
        return this.coursePlayHistoryDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<CoursePlayHistory> queryAllByLimit(int offset, int limit) {
        return this.coursePlayHistoryDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param coursePlayHistory 实例对象
     * @return 实例对象
     */
    @Override
    public CoursePlayHistory insert(CoursePlayHistory coursePlayHistory) {
        this.coursePlayHistoryDao.insert(coursePlayHistory);
        return coursePlayHistory;
    }

    /**
     * 修改数据
     *
     * @param coursePlayHistory 实例对象
     * @return 实例对象
     */
    @Override
    public CoursePlayHistory update(CoursePlayHistory coursePlayHistory) {
        this.coursePlayHistoryDao.update(coursePlayHistory);
        return this.queryById(coursePlayHistory.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Object id) {
        return this.coursePlayHistoryDao.deleteById(id) > 0;
    }
}
